import React, {useState, useEffect} from 'react'
import NavBar from '@components/NavBar'
import { Toast } from 'react-vant'
import banner from '@images/jiedian.jpg'
import request from "@services/request";
import './index.less'

const Node = (props) => {
  const { navigate } = props

  useEffect(() => {
  }, [])

  const { publicKey, signMessage } = JSON.parse(localStorage.getItem('biwSign') || '{}')

  const onSubmit = async () => {
    const params = {
      publicKey,
      sign: signMessage
    }

    try {
      const res = await request.post("app_server/buy_super", params);
    } catch (error) {
      console.log(error)
    }
  }

  return (
    <>
      <div className="node">
        <NavBar title="超级节点" />
        <div className="main">
          <div className="node-banner">
            <img src={banner} />
          </div>
          <div className="node-title">超级节点</div>
          <ul className="node-form">
            <li>
              <span>滑点分红：</span>
              <span>3%</span>
            </li>
            <li>
              <span>团队收益：</span>
              <span>3%</span>
            </li>
          </ul>
          <button className="shop-btn" onClick={() => onSubmit()}>立即购买</button>
          <p className="shop-tips">购买金额：1000.00 U</p>
        </div>
      </div>
    </>
  )
}

export default Node;